<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			let file = 'a.png';
			if(file.endsWith('.txt')){
				console.log('文本文件');
			}else if(file.endsWith('.png')){
				console.log('图片文件');
			}else{
				console.log('其他文件');
			}
		</script>
	</head>
	<body>
	</body>
</html>
